package com.chen.demo.simple.command;

import cn.hutool.core.bean.BeanUtil;
import com.chen.demo.simple.domain.entity.Book;
import com.chen.winnerframework.cqrs.command.Command;
import lombok.Data;

import javax.validation.constraints.NotBlank;

@Data
public class BookAddCommand implements Command {
    @NotBlank(message = "图书名称不能为空")
    private String name;

    public Book to() {
        return BeanUtil.toBean(this, Book.class);
    }

}
